// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'

Vue.use(VueRouter)
import App from './App'

import routes from './routes'

const router = new VueRouter({
  routes
})

router.beforeEach((to, from, next) => {
  if (to.query.admin && to.path != '/confirm') {
    let route = Object.assign({}, to);
    route.path = '/confirm';
    next(route)
  } else
    next();
})


const app = new Vue({
  router,
  el: '#app',
  render: h => h(App),
})

